package main;

import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.Properties;

import agents.CarParkAgent;
import agents.CarGeneratorAgent;
import interfaces.Settings;

public class SOSCarParkServer extends SOSServer {
	
	private static final String CarGeneratorAgent = "CarGeneratorAgent";
	
	private static SOSCarParkServer instance = null;
	
	public static SOSCarParkServer getInstance() {
		return instance;
	}
	
	/**
	 * @param settings
	 */
	public SOSCarParkServer(Properties settings) {
		super(settings, new HashMap<String, String>());
		instance = this;
		getAgentCollection().clear();
		getAgentCollection().put(new CarParkAgent(Settings.CAR_PARK_AGENT));
		getAgentCollection().put(new CarGeneratorAgent(CarGeneratorAgent));
		
		runServer();	
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		File file = new File("config.ini");
		Properties settings = new Properties();
		try {
			FileInputStream fis = new FileInputStream(file);
			settings.load(fis);
			fis.close();
		} catch (Exception e) {
		}
		new SOSCarParkServer(settings);
		
	}

}
